package com.sunfeng.a05;

import com.fasterxml.jackson.dataformat.xml.util.AnnotationUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.*;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.MethodMetadata;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;
import java.util.Set;

/**
 * @Author : 孙峰
 * @Description: @Component、@Bean、<bean/> 这些都会解析为BeanDefinition对象
 * @Date : 2022/4/8  18:03
 */
@Slf4j
public class A05Application {
    public static void main(String[] args) throws IOException {
        // 这是一个干净的容器
        GenericApplicationContext context = new GenericApplicationContext();

         context.registerBean("config", Config.class);
//        @ComponentScan @Bean @Import() @ImportResource
//        context.registerBean(ConfigurationClassPostProcessor.class);
//        context.registerBean(MapperScannerConfigurer.class,bd -> {
//            bd.getPropertyValues().add("basePackage","com.sunfeng.a05.mapper");
//        });
        //context.registerBean(ComponentScanPostProcessor.class);

       // context.registerBean(AtBeanPostProcessor.class);





        context.refresh();
        log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        for (String definitionName : context.getBeanDefinitionNames()) {
            System.out.println(definitionName);
        }
        log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

        context.close();
    }
}
